package com.ztjy.market.biz.impl;

import com.ztjy.bean.Orderdetails;
import com.ztjy.market.biz.OrderdetailsBiz;
import com.ztjy.market.dao.OrderdetailsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class OrderdetailsBizImpl implements OrderdetailsBiz {
    @Autowired
    private OrderdetailsDao oddao;

    @Override
    public Orderdetails findOrderdetailsById(Integer detailsId) {
        return oddao.findOrderdetailsById(detailsId);
    }

    @Override
    public boolean addOrderdetails(List<Orderdetails> orderdetails) {
        boolean flag=false;
        try {
            for(Orderdetails od:orderdetails){
                flag=oddao.addOrderdetails(od);
                if(!flag){
                    break;
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            flag=false;
        }
        return flag;
    }

    @Override
    public boolean delDetailsOrdersId(String orderid) {
        return oddao.delDetailsOrdersId(orderid);
    }

    @Override
    public List<Orderdetails> findByOrderId(String orderid) {
        return oddao.findByOrderId(orderid);
    }
}
